#ifndef MYDATEBASE_H
#define MYDATEBASE_H

#include <QObject>
#include <QSqlDatabase>

const QString  CREATE_USER_TABLE =
"CREATE TABLE IF NOT EXISTS 'T_USER'" \
"([ID] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," \
"[UserNo] TEXT NOT NULL," \
"[UserKey] TEXT,"\
        "[LastLoginTime] TEXT," \
        "[LogFlag] INTEGER," \
"[UserRight] INTEGER)";

class MyDatebase : public QObject
{
    Q_OBJECT
public:
    explicit MyDatebase(QObject *parent = 0);
    bool InitDB();
    void CloseDB();
    int GetUserCount();
    bool CheckUser(QString UserNo,QString UserKey);
    bool CreateUser(QString UserNo,QString UserKey);
signals:
    
public slots:
private:
    QSqlDatabase m_SqlDB;
    QString m_DBName;
    bool createTable(QSqlDatabase db);
};
MyDatebase* getDB();
#endif // MYDATEBASE_H
